﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;

namespace Models
{
    [Serializable()]
    public class Session : ISerializable
    {
        public DateTime CreationDate { get; set; }
        public String SessionName { get; set; }
        public String SessionPath { get; set; }
        public String TriggeringQuestion { get; set; }

        public Session()
        {
            CreationDate = DateTime.Now;

        }

        public void Save()
        {


        }

        #region Serialization

        //Serialization function.
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("CreationDate", CreationDate);
            info.AddValue("SessionName", SessionName);
            info.AddValue("TriggeringQuestion", TriggeringQuestion);
            info.AddValue("SessionPath", SessionPath);
            //info.AddValue("IdeaList", IdeaList);
            //info.AddValue("Participants", Participants);
        }

        //Deserialization constructor.
        public Session(SerializationInfo info, StreamingContext ctxt)
        {
            CreationDate = (DateTime)info.GetValue("CreationDate", typeof(DateTime));
            SessionName = (String)info.GetValue("SessionName", typeof(string));
            SessionPath = (String)info.GetValue("SessionPath", typeof(string));
            TriggeringQuestion = (String)info.GetValue("TriggeringQuestion", typeof(string));

            //IdeaList = (ObservableCollection<Idea>)info.GetValue("IdeaList", typeof(Idea));
            //Participants = (ObservableCollection<Participant>)info.GetValue("Participants", typeof(Participant));
        }

        #endregion

    }
}
